<?php
class RoleManageAction extends Action{
    
    public function roleManage(){
    	$this->assign("validateMenuJuri",true);
        //global $cookieTools;
        //$qiaoba = $cookieTools->getCookie('qiaoba');
        //$this->smarty->assign("qiaoba",$qiaoba);
    	$this->assign("smarty",'/manage/page/systemmanage/systemrolemanage/roleManage.html');
        
        return $this->SMARTY;
    }
    
    //分页查询角色信息
    public function queryRoleInfos(){
    	tsLoad('/manage/busi/SysRolePage.class.php');
    	session_start();
    	
    	//收集当前传入的当前页信息
    	if(isset($_POST['page']))
    		$currentPage = $_POST['page'];
    	else
    		$currentPage =1;
    	//收集当前传入的一页多少条信息
    	if(isset($_POST['rows']))
    		$countPage = $_POST['rows'];
    	else
    		$countPage =20;
    	
    	$sysRolePage = new SysRolePage();
    	$pageInfo = $sysRolePage->initPage($_POST, $countPage, $currentPage);
    	$rows = $sysRolePage->getCurPageData();
    	
    	$this->assign("total",$pageInfo['countRow']);
    	$this->assign("rows",$rows);
    	return $this->JSON;
    }
    
    //查询单个角色信息以便于修改
    public function queryRoleInfo(){
    	tsLoad('/manage/busi/SysRolePage.class.php');
    	session_start();
    	 
    	$sysRolePage = new SysRolePage();
    	$roleInfo = $sysRolePage->queryRoleInfoByRoleId($_POST);
    	
    	$this->assign("roleInfo",$roleInfo);
    	return $this->JSON;
    }
    
    //修改单个角色信息
    public function updateRoleInfo(){
    	tsLoad('/manage/busi/SysRolePage.class.php');
    	session_start();
    
    	$sysRolePage = new SysRolePage();
    	$result = $sysRolePage->updateRoleInfoByRoleId($_POST);
    	 
    	$this->assign("result",$result);
    	return $this->JSON;
    }
    
    //修改单个角色状态信息
    public function updateRoleStateInfo(){
    	tsLoad('/manage/busi/SysRolePage.class.php');
    	session_start();
    
    	$sysRolePage = new SysRolePage();
    	$result = $sysRolePage->updateRoleInfoByRoleId($_POST);
    
    	$this->assign("result",$result);
    	return $this->JSON;
    }
    
    //插入一个角色信息
    public function insertRole(){
    	tsLoad('/manage/busi/SysRolePage.class.php');
    	session_start();
    	 
    	$sysRolePage = new SysRolePage();
    	$result = $sysRolePage->addRole($_POST);
    	
    	$this->assign("result",$result);
    	return $this->JSON;
    }
    
    //查询一个菜单信息通过角色ID
    public function queryMenusByRoleId(){
    	tsLoad('/manage/busi/SysMenuBusi.class.php');
    	session_start();
    	
    	$sysMenuBusi = new SysMenuBusi();
    	$roleMenus = $sysMenuBusi->queryRoleMenuList($_POST);
    	 
    	$this->assign("roleMenus",$roleMenus);
    	return $this->JSON;
    }
    
    //插入一个角色菜单信息
    public function addRoleMenus(){
    	tsLoad('/manage/busi/SysMenuBusi.class.php');
    	session_start();
    	 
    	$sysMenuBusi = new SysMenuBusi();
    	$result = $sysMenuBusi->addRoleMenus($_POST);
    	
    	$this->assign("result",$result);
    	return $this->JSON;
    }
}
?>